package api;

import feign.Headers;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pojo.Account;
import pojo.AccountAndOrder;
import pojo.Order;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by TD on 2022/1/5
 */
@RequestMapping("/order")
public interface OrderFeignApi {

    @GetMapping("insert")
    public List<Order> insertOrder(@RequestParam("accountId") Long accountId, @RequestParam("commodityCode") String commodityCode, @RequestParam("count") Long count, @RequestParam("money") Long money);

    @GetMapping("/get")
    public Order getOrder(@SpringQueryMap Order order,@RequestParam("accountId") Long accountId);


    @GetMapping("id/{id}")
    public List<Order> id(@PathVariable("id") String id);


    @PostMapping("addOrder")
    public Order addOrder(@RequestBody Order order);

    @PostMapping("addOrderAnd")
    public Order addOrderAnd(@RequestBody AccountAndOrder accountAndOrder);



    @GetMapping("/noParam")
    public List<Order> noParam(@RequestParam("list") List<Long> list);

    @GetMapping("/download")
    public ResponseEntity<byte[]> download(@RequestParam("filePath") String filePath) ;


    @PostMapping(value = "/spring/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces =MediaType.APPLICATION_JSON_VALUE )
    @ResponseBody
    public Object springUpload(@RequestPart("file") MultipartFile file) throws InterruptedException;
}
